//
//  SystemMessageViewController.m
//  firstpoint
//
//  Created by 泽中 on 2017/7/18.
//  Copyright © 2017年 xzcysoft. All rights reserved.
//

#import "SystemMessageViewController.h"
#import "SystemMessageTableViewCell.h"
#import "XiTongXiaoXiXQViewController.h"
#import "CustomerServiceViewController.h"
#import "DaiFuViewController.h"
@interface SystemMessageViewController ()<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate>
{
    UITableView*tabView;
    NSArray*imgArr;
    NSArray*titleArr;
    NSArray*infoArr;
    UITextField*seachTexf;
}
@property(nonatomic,strong)UITextField*SSSRTextField;
@end

@implementation SystemMessageViewController
-(void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBar.hidden=NO;
}
-(void)httpRequestXT
{
    NSString*tokenStr= OBJECT_FOR_KEY(@"token");
    NSString*urlStr=[NSString stringWithFormat:@"/information/systemInformation.api?access_token=%@",tokenStr];
    [HTTPURL postRequest:LINK_BASE_URL(urlStr) parameters:@{} success:^(NSURLSessionDataTask *task, id responseObject) {
        NSLog(@"%@",responseObject);
    } filure:^(NSURLSessionDataTask *task, id error) {
        
    }];

}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"系统消息";
    [self httpRequestXT];
    self.view.backgroundColor=LRRGBColor(235, 240, 242);
    UIImage*img1=[UIImage imageNamed:@"xxgrzxtz"];

    UIImage*img2=[UIImage imageNamed:@"xxgrzxshxx"];
    UIImage*img3=[UIImage imageNamed:@"xxgrzxdfxx"];

    imgArr=@[img1,img2,img3];
    titleArr=@[@"系统消息",@"售后信息",@"代付信息"];
    [self addsousuo];
    [self setTab];
    // Do any additional setup after loading the view.
}
//搜索框
-(void)addsousuo{
    UIView*NVView =[[UIView alloc]init];
    NVView.frame=CGRectMake(0, 64, width_screen, 40);
    NVView.backgroundColor = COLOR(212, 217, 220, 1);
    [self.view addSubview:NVView];
    //输入框背景
    UIView * sosuobgView = [[UIView alloc]initWithFrame:CGRectMake(10, 5, width_screen-20 , 30)];
    sosuobgView.backgroundColor = [UIColor whiteColor];
    [sosuobgView.layer setMasksToBounds:YES];//编辑
    [sosuobgView.layer setCornerRadius:4.0];//圆角度
    [NVView addSubview:sosuobgView];
    //搜索按钮
    UIButton *SSbutton = [UIButton buttonWithType:UIButtonTypeCustom];
    SSbutton.frame = CGRectMake(4, 2.5, 25, 25);
    [SSbutton setImage:[UIImage imageNamed:@"Imported Layers"] forState:UIControlStateNormal];
    [sosuobgView addSubview:SSbutton];
    //搜索输入框
    _SSSRTextField = [[UITextField alloc]initWithFrame:CGRectMake(30, 1, 461, 29)];
    _SSSRTextField.placeholder = @"serach";
    _SSSRTextField.font = [UIFont systemFontOfSize:13];
    [_SSSRTextField setValue:COLOR(187, 187, 187, 1) forKeyPath:@"_placeholderLabel.textColor"];
    _SSSRTextField.returnKeyType = UIReturnKeySearch;
    _SSSRTextField.returnKeyType=UIReturnKeySearch;
    _SSSRTextField.delegate = self;
    [sosuobgView addSubview:_SSSRTextField];
}

-(void)setTab
{
    tabView=[[UITableView alloc]initWithFrame:CGRectMake(0, 104, width_screen, height_screen-104) style:0];
    tabView.backgroundColor=LRRGBColor(235, 240, 242);
    tabView.separatorStyle=0;
    tabView.delegate=self;
    tabView.dataSource=self;
    [tabView registerClass:[SystemMessageTableViewCell class] forCellReuseIdentifier:@"cell"];
    
    [self.view addSubview:tabView];
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60.0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    SystemMessageTableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:@"cell"];
    cell.imgView.image=imgArr[indexPath.row];
    cell.titleLab.text=titleArr[indexPath.row];
    cell.infoLab.text=@"外面的世界很无奈...";
    return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row==0) {
        XiTongXiaoXiXQViewController*vc=[XiTongXiaoXiXQViewController new];
        [self.navigationController pushViewController:vc animated:YES];
    }if (indexPath.row==1) {
        CustomerServiceViewController*vc=[CustomerServiceViewController new];
        [self.navigationController pushViewController:vc animated:YES];
    }if (indexPath.row==2) {
        DaiFuViewController*vc=[DaiFuViewController new];
        [self.navigationController pushViewController:vc animated:YES];
    }

   
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
